<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="__PUBLIC__js/extjs/ext-all.js"></script>
<script type="text/javascript" src="__PUBLIC__js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__js/extjs/resources/css/ext-all.css" />
<script>
		Ext.onReady(function(){
			Ext.create('Ext.data.Store', {
			    storeId:'adminlist',
			    fields:['name','oper'],
			    data:{'items':[
			        <?php if(is_array($list)): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): ++$i;$mod = ($i % 2 )?>{ 'name': '<?php echo ($vo["username"]); ?>','oper':'<?php echo ($vo["id"]); ?>'},<?php endforeach; endif; else: echo "" ;endif; ?>
			        ]},
			    proxy: {
			        type: 'memory',
			        reader: {
			            type: 'json',
			            root: 'items'
			        }
			    }
			});

		Ext.create('Ext.grid.Panel', {
		    title: '管理员列表',
		    store: Ext.data.StoreManager.lookup('adminlist'),
		    columns: [
		        { header: '用户名',  dataIndex: 'name',width:250 },
		        {
		        	header:'操作',
		        	 menuDisabled: true,

		                sortable: false,
		                xtype: 'actioncolumn',
		                width: 40,
		                items: [{
		                  icon: '__PUBLIC__js/extjs/examples/restful/images/delete.png',
				        	 tooltip:'delete',
				        	 handler: function(grid, rowIndex, colIndex) {
		                     var rec = grid.getStore().getAt(rowIndex);
			                 id=rec.get('oper');
			                 if(confirm('确定删除管理员【'+rec.get('name')+'】'))
			                	 {
					                 $.post('__URL__/deladmin/',{'id':id},function(){
					                	 window.location.reload();
					                 })
			                	 }
		                  }
		              }]
		        },
		    ],
		    height: 200,
		    width: 300,
		    renderTo: Ext.getBody()
		}).center();
		})
		</script>
</head>
<body>
</body>
</html>